package com.example.gaojt.androiddemo.statical;

import android.app.Activity;
import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;

import com.example.gaojt.androiddemo.R;
import com.example.gaojt.androiddemo.statical.sdk.StatisticsApi;

import java.util.HashMap;

/**
 * Created by gaojt on 7/9/17.
 */

public class DemoActivity extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        PackageManager pm = this.getPackageManager();
        String[] libs = pm.getSystemSharedLibraryNames();
        if (libs != null) {
            for (String s : libs) {
                Log.w("aac", "onCreate: s = " + s);
            }
        }

        FeatureInfo[] systemAvailableFeatures = pm.getSystemAvailableFeatures();
        for (FeatureInfo systemAvailableFeature : systemAvailableFeatures) {
            Log.w("aac", "onCreate: systemAvailableFeature = " + systemAvailableFeature.toString());
        }

        setContentView(R.layout.statical_demo_ly);
        findViewById(R.id.sendA).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StatisticsApi.onEvent("aaa");
            }
        });

        findViewById(R.id.sendB).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("aa", "aa");
                StatisticsApi.onEvent("bbb", map);
            }
        });

        findViewById(R.id.sendC).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("aa", "aaa");
                map.put("bb", "bbb");
                map.put("cc", "ccc");
                StatisticsApi.onEvent("ccc", map);
            }
        });
    }
}
